//
//  CreateJobReviewInstallDateView.swift
//  GreenDeal
//
//  Created by Moennig Q on 2023/3/7.
//

import UIKit

class CreateJobReviewInstallDateView: View {
    let titleView = CreateJobReviewSectionView(R.string.localizable.scheduledDateOfInstall().uppercased(),haveEditBtnFlag: true)
    let installDateText = CreateJobReviewContentLabel()
    override func setUpView() {
        //titleView
        self.addSubview(titleView)
        titleView.snp.makeConstraints { make in
            make.top.left.right.equalToSuperview()
            make.height.greaterThanOrEqualTo(0)
        }
        //
        //installDate
        let installDateTitle = CreateJobReviewTitleLabel(R.string.localizable.scheduledDateOfInstall())
        installDateTitle.numberOfLines = 0
        self.addSubview(installDateTitle)
        installDateTitle.snp.makeConstraints { make in
            make.top.equalTo(titleView.snp.bottom).offset(16)
            make.left.equalTo(16)
            make.size.greaterThanOrEqualTo(0)
            make.bottom.equalTo(-16)
        }
        installDateText.setContentHuggingPriority(.required, for: NSLayoutConstraint.Axis.horizontal)
        installDateText.setContentCompressionResistancePriority(.required, for: NSLayoutConstraint.Axis.horizontal)
        self.addSubview(installDateText)
        installDateText.snp.makeConstraints { make in
            make.top.equalTo(installDateTitle)
            make.right.equalTo(-16)
            make.size.greaterThanOrEqualTo(0)
        }
    }
    func setData(){
        self.installDateText.text = DateUtil().getDatetimeStr(CreateJobModelHelper.shared.createJobViewModel.installDate, format: "dd/MM/yyyy")
    }
}
